<template>
  <div id="app" :style="backgroundDiv">
    <div id="nav">
      <span style="font-size:18px">Sam's</span>
      <div class="router-box">
        <router-link to="/">首页</router-link>
      </div>
      |

      <div class="router-box">
        <router-link to="/blogs">博客</router-link>
      </div>
      |

      <div class="router-box">
        <router-link to="/about">关于</router-link>
      </div>
      |

      <div class="router-box">
        <router-link to="/messages">留言</router-link>
      </div>
      |

      <div class="router-box" v-show="this.GLOBAL.isManager">
        <router-link to="/management">管理</router-link>
      </div>

      <div class="login-button">
        <router-link to="/login">登录/注册</router-link>
      </div>
    </div>
    <router-view class="content" />
  </div>
</template>

<style lang="less">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  // // background-image: url("./assets/images/background.JPG");
  // background-repeat: no-repeat;
  // background-size: 100%, 100%;
  // background: black;
}

#nav {
  // padding: 10px;
  position: fixed;
  margin: 0 auto;
  width: 100%;
  background-color: rgba(255, 255, 255, 0.8);
  top: 0;
  z-index: 2;

  span {
    position: absolute;
    left: 0;
    width: 10%;
    margin-top: 10px;
    margin-bottom: 10px;
    font-weight: bold;
  }

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}

.content {
  padding: 40px;
  min-height: 900px;
}

.router-box {
  display: inline-block;
  width: 120px;
  text-align: center;
  margin-top: 10px;
  margin-bottom: 10px;
  font-size: 18px;
}

.login-button {
  display: inline-block;
  position: absolute;
  right: 0;
  width: 6%;
  margin: 5px;
  padding-top: 5px;
  padding-bottom: 5px;
  border-radius: 15px;
  background: #ffffffc9;
}

.login-button a:hover,
.login-button a:active {
  color: #42b983;
}
</style>



<script>
sessionStorage.setItem("isLogined",false);

export default {
  data() {
    return {
      isManager:this.$root.isManager,
      backgroundDiv: {
        background: "url(" + require("./assets/images/background.jpg") + ")  center center fixed",
        backgroundRepeat: "no-repeat",
        backgroundSize: "100% 100%"
      }
    };
  }
};
</script>